package cn.louguanyang.azure;

import android.app.Application;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.tencent.bugly.crashreport.CrashReport;

import cn.louguanyang.carbon.cache.BitmapCache;

/**
 * Created by louguanyang on 15/12/24.
 */
public class AzureApplication extends Application {
    public String TAG = AzureApplication.class.getSimpleName();
    public static AzureApplication mInstance;
    private RequestQueue mRequestQueue;
    private ImageLoader mImageLoader;

    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
        CrashReport.initCrashReport(getApplicationContext(), "900016470", false);
    }

    private AzureApplication() {

    }

    public static synchronized AzureApplication getInstance() {
        return mInstance;
    }

    public RequestQueue getRequestQueue() {
        if (mRequestQueue == null) {
            mRequestQueue = Volley.newRequestQueue(getApplicationContext());
        }
        return mRequestQueue;
    }

    public ImageLoader getImageLoader() {
        if (mImageLoader == null) {
            mImageLoader = new ImageLoader(getRequestQueue(), new BitmapCache());
        }
        return mImageLoader;
    }

}
